#include<iostream>
#include<algorithm>
using namespace std;
const int N = 1e5 + 10;
int n, m;
int w[N];
bool check(int x)
{
	int pre = 1;
	int cnt = 1;
	for (int i = 2; i <= n; i++) {
		if (w[i] - w[pre] >= x) {
			cnt++;
			pre = i;
		}
	}
	return cnt >= m;
}
int main()
{
	cin >> n >> m;
	for (int i = 1; i <= n; i++) {
		cin >> w[i];
	}
	sort(w + 1, w + n + 1);
	int l = 1e9, r = w[n] - w[1];
	for (int i = 2; i <= n; i++) {
		l = min(w[i] - w[i - 1], l);
	}
	while (l + 1 < r) {
		int mid = (l + r) >> 1;
		if (check(mid))l = mid;
		else r = mid;
	}
	cout << l << endl;
	return 0;
}